package cn.hesion.goods.sevices.impl;
/**
 * ClassName: BrandServiceImpl <br/>
 * Description: <br/>
 * date: 2020/12/15 17:34<br/>
 *
 * @author Hesion<br />
 * @version
 * @since JDK 1.8
 */

import cn.hesion.goods.dao.BrandMapper;
import cn.hesion.goods.pojo.Brand;
import cn.hesion.goods.sevices.IBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: changgou-parent
 * @description:
 * @author: hesion
 * @create: 2020-12-15 17:34
 **/
@Service
public class BrandServiceImpl implements IBrandService {

    @Autowired
    private BrandMapper brandMapper;

    @Override
    public List<Brand> getAllBrand() {
        return brandMapper.selectAll();
    }

    @Override
    public Brand findBrandById(Integer id) {
        return brandMapper.selectByPrimaryKey(id);
    }

    @Override
    public void insertBrand(Brand brand) {
        // 这个方法忽略空值
        brandMapper.insertSelective(brand);
    }

    @Override
    public void updateBrandByKey(Brand brand) {
        // 这个方法忽略空值
        // 有啥改啥,没啥啥也不改
        brandMapper.updateByPrimaryKeySelective(brand);
    }
}
